<?php

/**
 * Created by PhpStorm.
 * User: Sergey
 * Date: 22.02.14
 * Time: 16:32
 */
class Question
{
    public $id;
    public $content;
    public $quizId;

    /** @var array */
    public $answers;

    /**
     * Default constructor
     */
    public function __construct()
    {
        $this->quizId = 0;
        $this->answers = array();
    }

    /**
     * @return int
     */
    public function getAnswersCount()
    {
        return count($this->answers);
    }

    /**
     * @return int
     */
    public function getCorrectAnswersCount()
    {
        $count = 0;
        foreach ($this->answers as $ans) {
            $count += ($ans->isCorrect) ? 1 : 0;
        }
        return $count;
    }
} 